<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAppraisesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('appraises', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->default(0)->comment('用户ID');
            $table->tinyInteger('type')->default(0)->comment('类型:0=评价洗车服务,1=评价商品订单');
            $table->string('order_id')->default(0)->comment('订单ID');
            $table->integer('detail_id')->default(0)->comment('订单详情ID');
            $table->integer('good_id')->default(0)->comment('商品ID');
            $table->integer('service_id')->default(0)->comment('服务ID');
            $table->integer('shop_id')->default(0)->comment('店铺ID');
            $table->integer('worker_id')->default(0)->comment('师傅ID');
            $table->integer('score')->default(0)->comment('评分');
            $table->text('content')->comment('评价内容');
            $table->json('images')->nullable()->comment('评价图片');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('appraises');
    }
}
